COMPSCI 115 Lab 2
Topic: Loops
Four parts:
• Write a program which prints a sequence of integers that are multiples of 10, starting at 0 and ending at 100.
• Write a program that computes the average of 10 random odd integers, ranging from 0 to 500.
• Write a program that prints whatever the user enters, and stops when the user types “done”, using an infinite loop and a break statement.
• Same as number three but use a condition. The loop terminates when the condition is equal to “done”.
1 Sample run:
0
10
20
30
40
50
60
70
80
90
100
2 Sample run:
449
9
143
101
115
479
299
115
199
211
The Average of the numbers is: 212.0
3 & 4 Sample run:
say something: hello
you said : hello
say something: what’s up?
you said : what’s up?
say something: done
you said : done
Goodbye!